$(document).ready(function () {
	
	loadtable();
	

//	searchCus();
})			
function loadtable()
{	 
	var columns = [[
	                {field:'cusids',title:'顾客ids',hidden:true},
					{field:'cusname',title:'姓名',width:100,align:'center'},
					{field:'cusphone',title:'手机号',width:100,align:'center'},
					{field:'cuslastweight',title:'最后体重（斤）',width:100,align:'center'},
					{field:'servicecount',title:'减肥次数',width:100,align:'center'},
					{field:'outshop',title:'转出门店',width:100,align:'center'},
					{field:'caozuo',title:'操作',width:100,align:'center',
						formatter: function(value,row,index)
						{	
							var ids=row.cusids;
							return  '<button href="#" style="height:25px;width:50px;background:#00A65A;color:white" onclick="checkContent(\'' + ids + '\')">查看</button>';
						}
					}
			    ]];
	var url="/bintoShop/getIntoShop";
	var reData = common_ajax.ajaxFunc(url,null,"json");
	
	
	$('#_intoShop_datagrid').datagrid({
		 cls: "theme-datagrid",
		 fitColumns:true,
		 singleSelect: true,
		 rownumbers: true, //显示序号
		 columns: columns,
		 url:cxt + "/bintoShop/getIntoShop"
//		 data:reData
	});


}
function  checkContent(cusids)
{	
	loadDialog($("#_intoShop_datagrid"),null, '顾客转出单', 'bintoShop/showOutInfo?customerIds='+cusids);
//	loadDialog($("#" + organTableId), organTree, '添加代理',
//			'organization/toAdd?ids=' + treeNode.id);

} 


//获取顾客信息
function searchCus() {
	
	
	var outShopIds=$('#organIds').val();
	
	var url="/bintoShop/searchCus";
	var data={"outShopIds":outShopIds};
	var reData = common_ajax.ajaxFunc(url,data,"json");
	if(reData=="")
	{
		$.alert(parent.$, "没有要转入的顾客！");
	}else
	{
		$('#_intoShop_datagrid').datagrid({
			data:reData
		})
		    
	}
	  
}

function clear(){
	$("#customerName").textbox("clear");
	$("#customerPhone").textbox("clear");
	
//	$("#customerHybh").textbox("clear");
}



